#coding:utf-8
'''
Created on 2010-12-20

@author: fengbingjian
'''
from catch import catch
from speek import speek
from exeSql import exeSql
class read:
    catch = None
    speed = None
    sql = None
    id = 1
    def __init__(self):
       
        self.catch = catch()
        self.speek = speek(None , None)
        self.sql = exeSql()
        self.speek.readText(u'初始化完成！...')
        print u'初始化完成！...'
    def start(self):
        print u'第'  + str(self.id) +u"次"
        self.speek.readText(u'第' + str(self.id) + u"次查看新闻")
        self.id += 1
        i = 1
        #self.catch.start()
        url , title , content = self.catch.getContent()
        print i , url , title , content
        while content != None:
            if title != None and title.strip() != "" and content.strip() != "":
              
                    
                    print u"第" + str(i) + u"条新闻"
                    print title,content
                    self.speek.readText(u"第" + str(i) + u"条新闻")
                    self.speek.readText(title)
                    self.speek.readText(content)
                
                    i+= 1
            url,title , content = self.catch.getContent()
        if i == 1:
            self.speek.readText(u'本次没有新发布的新闻')
        self.speek.readText(u'本次阅读完毕！...')
if __name__ == '__main__':
    r = read()
    while True:
        r.start()
